  PROGRAM: RAND, RAND2 and RANDin                     VER:5.5
    DESCR: Pulls 4 digit #s & names out of Hat (not same # twice)
KEY WORDS: FENTRY RANDOM NUMBER GENERATOR
   AUTHOR: FAST ENTRY PROGRAMMING
           Walter Killeen
           210 S. Lopez St.
           New Orleans, LA 70119
           (504)827-5989 (Voice & Fax)
Compuserv: 71511,35
  FidoNet: 1:396/17.22

Requires:DOS3.1  Monitor:Mono or CGA
Registration $25 .. $45
   (RAND & RAND2: $25 each, RANDin: $35 or all three for $45

Rand.exe is a random number Generator of excellent flexibility. It was
designed to produce a WINNING number such as is used in a raffle or
door prize situation. Once it picks a winner, and displays it with suitable
fanfare on the screen, that number, along with the time and date  will be added to a winners' list. (Sort of like pulling tickets from a hat)

In addition if the file GoodNums.lst exists, only numbers that exist in
that file are considered valid. Further, the frequency or order a number
is entered into the file HAS NO BEARING on how likely it will be picked.

┌──────────────────┐
│HOW RAND.EXE WORKS│
└──────────────────┘
To start RAND type: RAND {Which Random to Pick}

1. On the basis of the microsecond that the random number generator is started
   a four digit random number is generated (one digit at a time).

2. If the File: GoodNums.lst exists and contains, on its first line the
   words: ALL VALID NUMBERS, the file will be scanned sequentially for
   the first occurrence of the random number already generated in step 1.

3. If the number is not found, the program goes back to step 1 above,
   generates another number and looks again... and again... until it
   succeeds. If the file: GOODNUMS.LST doesn't exist the random number
   will be considered valid at this point.

4. It then opens the file: UsedNums.LST to see if the number was already
   used. If it has, you guessed it back to step 1.  Until the file of
   used numbers is erased, previous winners cannot win again.

5. At this point, RAND has generated a number that IS  a member of
   the first list and NOT a member of the second.  It now calls the
   TITLE.exe to display the number and whether it won!  Remember
   that little parameter that you started the program with? Lets say
   that you started with 3.

   RAND would display the first two numbers as non-winners and the third
   would be marked the winner. ONLY the number marked as a winner goes
   into USEDNUMS.LST. Since we  started the random number
   generator with a random number, there is NO WAY to fix the output. If the
   GOODNUMS.LST file is used, its full path is displayed at the time
   the numbers are displayed and the name is hard coded into the
   program. If used, GOODNUMS.LST MUST be in the same sub-directory that
   RAND.EXE is in.

┌───────────────────┐
│GOODNUMS.LST FORMAT│
└───────────────────┘
As mentioned above, GOODNUMS.LST is a simple ASCII text file. The first
line MUST read: ALL VALID NUMBERS (all caps, no leading or trailing
spaces).  After that, each valid number can be entered in any order on a
line by itself. Use a standard text editor (such as Edlin) to create the
file. Although only the first four characters are used for comparison,
since the file is re-scanned up to NINE THOUSAND times each time a number
is picked, it shouldn't contain anything else.

┌───────────┐
│PERFORMANCE│
└───────────┘
Yes, I know that I could have read all the numbers into an array and
sorted the list first but this is one of the few times when the object
is to create suspense. Let the computer churn a while. I didn't want the
program to get the answer too quickly... Some things are best done
SLOWLY... If you really want the computer to churn slowly, run from a floppy disk with BUFFERS=2.

If you need a quick reference (file names and such) just type:
      RAND2 /?

┌───────────────┐
│RAND2 OPERATION│
└───────────────┘
Like RAND, RAND2 generates random numbers but uses a different lookup
technique. Instead of generating a number then checking the GoodNums.LST
file RAND2 first counts the entries in the file. It then generates a
number that corresponds to one of the lines in the file. RAND2 then
retrieves that line as the winner. Since it only needs to search the
list once, RAND2 is MUCH FASTER!!
The catch. GoodNums.LST must contain only ONE of each member to be fair.
That's where RandIN comes in (See Below).

In addition to the number, RAND2 also reads up to 25 characters
following the number and displays it below the winner. Most groups enter
a person's full name here.

After displaying a winner, RAND2 asks what the lucky person won; that,
along with the "Name" date and time are recorded in the UsedNums.LST for
printout later. If, in response to the prompt, only an {Enter} is
pressed, the phrase "ABSOLUTELY NOTHING" is recorded with the name. This
does wonders for ensuring that those that leave early (and therefore
weren't present to claim their prize) can be sufficiently ribbed about
leaving early!! Some clubs regularly publish the list of NON-WINNERS to
boost attendance.

NOTE: While designed to create suspense, there are times when you
really want one of the programs to "hurry up". Most of the
display and noisemaking routines are interruptable. If you press
the spacebar during a screen pop-up, the pop-up will rapidly
complete and allow you to enter the next operation almost
instantly.


RandIN

To keep RAND2 honest, you should really use its companion product,
RandIN. It is designed to be a self check-in routine. When used with a
standard easily maintained text file of known members, RandIN completely
automates the process of gathering names of attendies for a drawing at
the end of a meeting. See RANDIN.HLP for more info.

FUTURE ENHANCEMENTS?!

The first thing that comes to mind, is the ability for guests to
register themselves. A club defined (system) variable could be created
that allows them to be registered to win or be added to a separate guest
list ...

What else? Depending on response, and suggestions... and my time to get
to them, just about anything.

REGISTRATION

RAND, RAND2, RandIN and TITLE are copyrighted materials and are being
marketed under the SHAREWARE concept. They are fully functional and
useful programs and as such, fully worth your consideration and my
compensation. Registration entitles you to a customized version of the
software to use. As mentioned above, you only have to register what you
use. By the way, TITLE.EXE is the display routine used by all three
programs, none of them will run without it.

RAND is $25
RAND2 is also $25
RandIN is $35
If you want to register all three, you may do so for only $45

In addition, registered users are allowed to get the SOURCE CODE
(TURBO PASCAL) for all three units for only $10 extra. Of course any
of you who decide NOT to register RandIN will have the world (and probably
more than a few of your members) know the exit password causing you MUCH
grief.

My you do like to read don't you. Look for other neat utilities under
the code name FENTRY. I can be reached on Compuserve (71511,35) or
Binkley E-mail 1:396/17.22

Happy computing!
Walter


